<template>
    <div class="the-card" :class="className">
        <div class="title">
            <div class="left">
                <img v-if="icon" class="icon" :src="icon" :alt="title" />
                <span class="text">{{ title }}</span>
                <slot name="header-left"></slot>
            </div>
            <div class="right">
                <slot name="header-right"></slot>
            </div>
        </div>
        <div class="content">
            <slot></slot>
        </div>
    </div>
</template>

<script>

export default {
    name: "theCard",

    props: {
        className: {
            type: String,
            default: "",
        },
        title: String,
        icon: {
            type: String,
            required: false,
        },
        loading: {
            type: Boolean,
            default: true,
        },
        useShow: {
            type: Boolean,
            default: false,
        },
    },
};
</script>

<style lang="scss" scoped>
.the-card {
    background-color: #fff;
    position: relative;
    // width: 1200px;
    margin: 12px auto;
    border-radius: 8px;

    .title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid #d7d7d7;

        .icon {
            width: 20px;
            height: 20px;
            margin-right: 4px;
        }

        .text {
            color: rgba(0, 0, 0, 0.85);
            font-weight: 700;
        }
    }

    .content {
        padding: 12px 20px;
    }
}
</style>
